const express = require('express') // 项目使用一个插件
const app = express() // 实例化一个服务器的应用
let http = require('http').Server(app);
let io = require('socket.io')(http);
const userRouter = require('./controlers/userController')




/* static Page setting */
app.set('view engine', 'ejs');
app.set('views', 'views');
app.use(express.static('static'))

app.get('/', function(req, res) {
    res.render('index');
});

// io.on('connection', function(socket) {
//     socket.on('getMessage', function(msg) {
//         io.emit('allChat', msg)
//     })
//     socket.on('disconnect', function() {
//         // console.log('user disconnected');
//     });
// });

http.listen(3000, function() {
    // console.log('listening on *:3000');
});

app.use('/user', userRouter)


app.listen(3001, '192.168.10.107')